package hl.games.tankwar.factorys;

import android.content.Context;
import android.graphics.BitmapFactory;
import hl.games.tankwar.core.GlobalVar;
import hl.games.tankwar.core.Map;
import hl.games.tankwar.ui.R;

public abstract class MapFactory {
	public static Map createMap(Context context)
	{
		Map backGroudLayer=new Map(GlobalVar.MAP_ROW_NUMBER,GlobalVar.MAP_COLUMN_NUMBER,
				BitmapFactory.decodeResource(context.getResources(), R.drawable.tiles),
				GlobalVar.MAP_TILE_WIDTH,GlobalVar.MAP_TILE_HIGHT);
		int[][] mapPoint;
		mapPoint=new int[][]{

				{0,0,0,0,0,-1,0,0,0,-1,0,0,0},

				{0,1,0,2,0,0,0,1,0,1,0,1,0},

				{0,1,0,0,0,0,1,1,0,1,2,1,0},

				{0,0,0,1,0,0,0,0,0,2,0,0,0},

				{3,0,0,1,0,0,2,0,0,1,3,1,2},

				{3,3,0,0,0,1,0,0,2,0,3,0,0},

				{0,1,1,1,3,3,3,2,0,0,3,1,0},

				{0,0,0,2,3,1,0,1,0,1,0,1,0},

				{2,1,0,2,0,1,0,1,0,0,0,1,0},

				{0,1,0,1,0,1,1,1,0,1,2,1,0},

				{0,1,0,1,0,1,1,1,0,0,0,0,0},

				{0,1,0,0,0,1,1,1,0,1,0,1,0},

				{0,1,0,1,0,1,6,1,0,1,1,1,0},

				};
	
		backGroudLayer.setPosition(GlobalVar.MAP_START_X, GlobalVar.MAP_START_Y);
		backGroudLayer.createAnimatedTile(Map.TILE_WATER_1);
		for (int i = 0; i < GlobalVar.MAP_ROW_NUMBER; i++) {
			for (int j = 0; j < GlobalVar.MAP_COLUMN_NUMBER; j++) {
				backGroudLayer.setCell(j, i, mapPoint[i][j]);
			}
		}
		return backGroudLayer;
	}
}
